dofile (getScriptPath() .. "\\..\\processor\\processor.lua")
dofile (getScriptPath() .. "\\..\\processor\\log.lua")

dofile (getScriptPath() .. "\\..\\lib\\lib.lua")
dofile (getScriptPath() .. "\\..\\lib\\orders.lua")

script_name = string.gsub(string.gsub(debug.getinfo(1).short_src, "%.[^%.]*$", ""), "^.*[\\/]", "")

--overstop = {}

processor:AddInit(function()
	if not lib:isConnected() then return true end
	client_code = lib:GetUser()
	if not client_code then return true end
	script_id = client_code .. "#" .. script_name
	log_file = lib.path.log .. script_id .. ".log"
end)
	
processor:AddInit(function()
	processor:InitLog(log_file)
end)

processor:AddInit(function()
	processor:log("started")
end)
	
processor:AddTimer(function()
	local ret
	for _, order in pairs(orders:GetActiveStops()) do
		ret = ret or orders:ReplaceActivatedStopOrder(order)
	end
	return ret
end)
